﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdGeSegmentChain2d : OdGeSplineEnt2d
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdGeSegmentChain2d(IntPtr cPtr, bool cMemoryOwn) : base(GlobalsPINVOKE.OdGeSegmentChain2d_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdGeSegmentChain2d obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdGeSegmentChain2d()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdGeSegmentChain2d(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public OdGeSegmentChain2d() : this(GlobalsPINVOKE.new_OdGeSegmentChain2d__SWIG_0(), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGeSegmentChain2d(OdGeSegmentChain2d source) : this(GlobalsPINVOKE.new_OdGeSegmentChain2d__SWIG_1(OdGeSegmentChain2d.getCPtr(source)), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGeSegmentChain2d(OdGePoint2dArray fitpoints) : this(GlobalsPINVOKE.new_OdGeSegmentChain2d__SWIG_2(OdGePoint2dArray.getCPtr(fitpoints).Handle), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGeSegmentChain2d(OdGeKnotVector knots, OdGePoint2dArray points) : this(GlobalsPINVOKE.new_OdGeSegmentChain2d__SWIG_3(OdGeKnotVector.getCPtr(knots), OdGePoint2dArray.getCPtr(points).Handle), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGeSegmentChain2d(OdGeCurve2d crv, double approxEps) : this(GlobalsPINVOKE.new_OdGeSegmentChain2d__SWIG_4(OdGeCurve2d.getCPtr(crv), approxEps), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGeSegmentChain2d Assign(OdGeSegmentChain2d pline)
		{
			OdGeSegmentChain2d result = new OdGeSegmentChain2d(GlobalsPINVOKE.OdGeSegmentChain2d_Assign(this.swigCPtr, OdGeSegmentChain2d.getCPtr(pline)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeSegmentChain2d setClosed(bool flag)
		{
			OdGeSegmentChain2d result = new OdGeSegmentChain2d(GlobalsPINVOKE.OdGeSegmentChain2d_setClosed(this.swigCPtr, flag), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeDoubleArray bulges()
		{
			OdGeDoubleArray result = new OdGeDoubleArray(GlobalsPINVOKE.OdGeSegmentChain2d_bulges(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeDoubleArray getBulges()
		{
			OdGeDoubleArray result = new OdGeDoubleArray(GlobalsPINVOKE.OdGeSegmentChain2d_getBulges(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGePoint2dArray vertices()
		{
			OdGePoint2dArray result = new OdGePoint2dArray(GlobalsPINVOKE.OdGeSegmentChain2d_vertices(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGePoint2dArray getVertices()
		{
			OdGePoint2dArray result = new OdGePoint2dArray(GlobalsPINVOKE.OdGeSegmentChain2d_getVertices(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool hasBulges()
		{
			bool result = GlobalsPINVOKE.OdGeSegmentChain2d_hasBulges(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private object locker = new object();

		private HandleRef swigCPtr;
	}
}
